<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="js/vue.js"></script>
    <title>Document</title>
    <style>
        #app1{
            width: 100px;
            height: 100px;
            background-color: red;
            transition: all 0.5s;
        }
    </style>
</head>
<body>
    <!-- 
        v-on:dom事件名字="方法（实参1，实参2..）"
        v-on="{dom事件名字：方法（实参1，实参2..），dom事件2：方法（...）}"

        html dom事件
        click鼠标点击
        mousedown鼠标按下
        mouseup 鼠标松开
        mouseover 鼠标经过
        mouseOut 鼠标离开
        change:输入内容有变
     -->
    <div id="app1" v-on={mousedown:Down,mouseup:Up,mouseover:Over,mouseout:Out}>{{name}}</div>
     <!-- <div id="app1" @click="Down"></div> -->
    <input type="text" id="ipt" v-on:change="chg" v-model="message">
    <script>
        var app1 = new Vue({
            el:"#app1",
            data:{
                name:"你好"
            },
            methods: {
                Down:function(msg){
                    this.name = ".";
                    document.getElementById("app1").style.backgroundColor = "green";
                },
                Up:function(){
                    this.name = "飞狼上将";
                    document.getElementById("app1").style.backgroundColor = "yellow";
                },
                Over:function(){
                    document.getElementById("app1").style.width = "200px";
                },
                Out:function(){
                    document.getElementById("app1").style.width = "100px";
                }
            },
        })
        var app2 = new Vue({
            el:"#ipt",
            data:{
                message:""
            },
            methods:{
                chg:function(){
                    app1.name = this.message;
                }
            }
        })
    </script>
</body>
</html>